package Arithmetic

fun bubbleSort(arr:IntArray){
    for(i in 0 until arr.size -1){
        for(j in 0 until arr.size-i-1){
            if(arr[j]> arr[j+1]){
                arr[j] = arr[j] + arr[j+1]
                arr[j+1] = arr[j] - arr[j+1]
//                arr[j], arr[j+1] = arr[j+1], arr[j]
                arr[j] = arr[j] - arr[j+1]
            }
        }
    }
}

fun main() {
    var arr:IntArray = intArrayOf(1,2,3,4,88,91,73,45)
    bubbleSort(arr)
    for (i in arr){
        println(i)
    }
}